/*
 * Copyright (C) 2021 Huawei Device Co., Ltd.
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.mapbox.ohos.gestures;

/**
 * Object that holds pixel current and previous distances between a pair of fingers.
 */
public class MultiFingerDistancesObject {
    private final float prevFingersDiffX;
    private final float prevFingersDiffY;
    private final float currFingersDiffX;
    private final float currFingersDiffY;
    private final float prevFingersDiffXY;
    private final float currFingersDiffXY;

    /**
     * MultiFingerDistancesObject
     *
     * @param prevFingersDiffX
     * @param prevFingersDiffY
     * @param currFingersDiffX
     * @param currFingersDiffY
     */
    public MultiFingerDistancesObject(float prevFingersDiffX, float prevFingersDiffY,
                                      float currFingersDiffX, float currFingersDiffY) {
        this.prevFingersDiffX = prevFingersDiffX;
        this.prevFingersDiffY = prevFingersDiffY;
        this.currFingersDiffX = currFingersDiffX;
        this.currFingersDiffY = currFingersDiffY;

        prevFingersDiffXY =
            (float) Math.sqrt(prevFingersDiffX * prevFingersDiffX + prevFingersDiffY * prevFingersDiffY);

        currFingersDiffXY =
            (float) Math.sqrt(currFingersDiffX * currFingersDiffX + currFingersDiffY * currFingersDiffY);
    }

    public float getPrevFingersDiffX() {
        return prevFingersDiffX;
    }

    public float getPrevFingersDiffY() {
        return prevFingersDiffY;
    }

    public float getCurrFingersDiffX() {
        return currFingersDiffX;
    }

    public float getCurrFingersDiffY() {
        return currFingersDiffY;
    }

    public float getPrevFingersDiffXY() {
        return prevFingersDiffXY;
    }

    public float getCurrFingersDiffXY() {
        return currFingersDiffXY;
    }
}

